import request from '../utils/request.js'
import store from '../store/index.js'

export function addKnowledge(knowledge) {
  return request({
    url: 'knowledge/addKnowledge',
    method: 'post',
    data: {
      knowledgeUserId: store.getters.userId,
      knowledgePartId: store.getters.userPartId,
      knowledgeContent: knowledge.knowledgeContent
    }
  })
}

export function getKnowledgeById(knowledgeId) {
  return request({
    url: 'knowledge/getKnowledgeByKnowledgeId/' + knowledgeId,
    method: 'get'
  })
}

export function getKnowledge() {
  return request({
    url: 'knowledge/getKnowledges',
    method: 'get'
  })
}

// export function updateKnowledge(knowledge) {
//   return request({
//     url: 'moment/add/',
//     method: 'get',
//     data: {
//       momnetUserId: store.getters.userId,
//       momentContent: moment.momentContent
//     }
//   })
// }

export function deleteKnowledge(knowledgeId) {
  return request({
    url: 'knowledge/deleteKnowledgeByKnowledgeId/' + knowledgeId,
    method: 'post'
  })
}
